package com.example.grape_effect.effet.filter

import com.example.grape_effect.gl.common.ShaderConstant
import com.example.grape_effect.gl.common.ShaderParameter


class BrightFilter: LYFilter() {

    init {
        name = "brightFilter"
    }
    override var vertexShader = ShaderConstant.NO_FILTER_VERTEX_SHADER
    override var fragmentShader =  """
        precision mediump float;
varying highp vec2 textureCoordinate;
uniform sampler2D inputTexture;
uniform lowp float brightness;

void main()
{
   lowp vec4 textureColor = texture2D(inputTexture, textureCoordinate);

   gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);
}
        """
    override fun addParameters() {
        super.addParameters()
        parameters["brightness"] = ShaderParameter("brightness", ShaderParameter.TYPE_UNIFORM, ShaderParameter.VALUE_TYPE_FLOAT)
    }
    override fun setDefaultParameterValues() {
        super.setDefaultParameterValues()
        parameters["brightness"]?.value = 0.1f
    }
}